STRIP

Section: User Commands (1)
Updated: January 31, 1992
Index Return to Main Contents
 

NAME

strip - remove symbols  

SYNOPSIS

strip [ option ] name ...  

DESCRIPTION

Strip removes or modifys the symbol table attached to the output of the assembler and link editor. This is useful to save space after a program has been debugged and to limit the symbols for use with rld(3). Strip no longer removes relocation entries under any condition. Instead it up dates the external relocation entries to reflect the resulting symbol table and prints a error message for those symbols not in the resulting symbol table and needed by an external relocation entry. The link editor ld(1) is the only program that can strip relocation entries and know if it is safe to do so.

The effect of strip without any options is the same as use of the -s option of ld(1). The options -S, -x, and -X have the same effect as the ld(1) options.

The options to strip(1) can be combined to trim the symbol table to just what is desired. This is to support stripping executables for later use with rld(3). This allows control of the interface that the executable wants to provide to the objects that it will load with rld and it will not have to publish symbols that are not part of it's interface. For example an executable that wishes to allow only a subset of it's global symbols but all of the shared libraries globals to be used would be stripped with:

% strip -s interface_symbols -A executable
where the file interface_symbols would contain only those symbols from the executable that it wishes the objects loaded with rld to have access to. Another example is an object that is maded up of a number of other objects that will be loaded into an executable would built and then stripped with:
% ld -o relocatable.o -r a.o b.o c.o
% strip -s interface_symbols -u relocatable.o
which would leave only the undefined symbols and symbols listed in the file interface_symbols in the object file. In this case strip(1) has updated the relocation entries to reflect the new symbol table.

The first set of options indicate symbols that are to be save in the resulting output file.

-s filename
Save the symbol table entries for the global symbols listed in filename. The symbol names listed in filename must be one per line with no other white space in the file except the newlines on the end of each line.
-d filename
Save the debugging symbol table entries for each source file name listed in filename. The source file names listed in filename must be one per line with no other white space in the file except the newlines on the end of each line. And they must be just the base name of the source file without any leading directories.
-A
Save all global absolute symbols except those with a value of zero, and save objective-C class symbols. This is intended for use of programs that use rld(3) and want the loaded code to use symbols from the shared libraries.
-n
Save all N_SECT global symbols. This is intended for use with executable programs in combination with -A to remove the symbols needed for correct static link editing which are not needed for use with rld(3) where using the -s filename would be too much trouble.
-u
Save all undefined symbols. This is intended for use with relocatable objects to save symbols referred to by external relocation entries. Note that common symbols are also referred to by external relocation entries and this flag does not save those symbols.

These options specify symbols to be removed from the resulting output file.

-S
Remove the debugging symbol table entries (those created by the -g option to cc(1) and other compilers).
-X
Remove the local symbols whose names begin with `L'.
-x
Remove all local symbols (saving only global symbols).

And one last option:

-
Treat all remaining arguments as file names and not options.
 

SEE ALSO

ld(1), rld(3), cc(1)  

LIMITATIONS

Not every layout of a Mach-O file can be stripped by this program. But all layouts produced by the compiler system can be stripped.


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO
LIMITATIONS

This document was created by man2html, using the manual pages.
Time: 17:18:46 GMT, March 25, 2025